import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;

public class Arrtest {

    public static void main(String[] args) throws Exception {
//        StringBuffer str = new StringBuffer();
//
//        String url = "jdbc:mysql://competition1:3306/gmall";
//        String user = "root";
//        String password = "Abc123..";
//
//        Class<?> aClass = Class.forName("com.mysql.cj.jdbc.Driver");
//
//        Driver driver = (Driver) aClass.newInstance();
//
//        DriverManager.registerDriver(driver);
//        Connection connection = DriverManager.getConnection(url, user, password);
//        PreparedStatement ps = connection.prepareStatement("select tm_name from base_trademark");
//        ResultSet resultSet = ps.executeQuery();
//        while (resultSet.next()){
//            String sku_name = resultSet.getString("tm_name");
//            str.append("\"").append(sku_name).append("\",");
//        }
//        System.out.println(str);

//        long time = new Date().getTime();
//        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
//        String format = dateFormat.format(time);
//        System.out.println(dateFormat.parse(format).getTime());
//
//        long time;
//        for (int i = 0; i < 30; i++) {
//
//            Random rand = new Random();
//            int flag = rand.nextInt(9) + 1;
//            long date = new Date().getTime();
//            date -= flag * 100000000;
//            if (flag % 2 == 0) {
//                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//                String format = dateFormat.format(date);
//                time = dateFormat.parse(format).getTime();
//            } else {
//                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
//                String format = dateFormat.format(date);
//                time = dateFormat.parse(format).getTime();
//            }
//        }

//        long time = 1648310400000L;
//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        String format = simpleDateFormat.format(time);
//        System.out.println(format);
        String[] nationArr = {
                "中国", "蒙古", "朝鲜", "韩国", "日本", "越南",
                "英国", "法国", "冰岛", "丹麦", "挪威", "瑞典", "芬兰",
                "埃及", "利比亚", "突尼斯", "阿尔及利亚", "摩洛哥", "尼日尔",
                "澳大利亚", "新西兰",
                "美国", "加拿大",
                "哥伦比亚", "委内瑞拉", "圭亚那", "苏里南"
        };
        String[] A = {"中国", "蒙古", "朝鲜", "韩国", "日本", "越南"};
        String[] O = {"英国", "法国", "冰岛", "丹麦", "挪威", "瑞典", "芬兰"};
        String[] F = {"埃及", "利比亚", "突尼斯", "阿尔及利亚", "摩洛哥", "尼日尔"};
        String[] D = {"澳大利亚", "新西兰"};
        String[] B = {"美国", "加拿大"};
        String[] N = {"哥伦比亚", "委内瑞拉", "圭亚那", "苏里南"};
        ArrayList<String> strings = new ArrayList<>();

        String[] regionArr = {"亚洲", "欧洲", "非洲", "大洋洲", "北美洲", "南美洲"};
        Random random = new Random();
        int nationkey;
        int regionkey;
        String NAME;
        for (int i = 0; i < 10; i++) {


            nationkey = random.nextInt(nationArr.length) + 1;
            NAME = nationArr[nationkey-1];
            if (Arrays.toString(A).contains(NAME)) {
                regionkey = 1;
            } else if (Arrays.toString(O).contains(NAME)) {
                regionkey = 2;
            } else if (Arrays.toString(F).contains(NAME)) {
                regionkey = 3;
            } else if (Arrays.toString(D).contains(NAME)) {
                regionkey = 4;
            } else if (Arrays.toString(B).contains(NAME)) {
                regionkey = 5;
            } else
                regionkey = 6;
            System.out.printf(NAME + ",");
            System.out.printf(nationkey + ",");
            System.out.println(regionkey + ",");
        }
    }
}
